# coding=utf-8
"""
    flask 启动文件

    相关命令 :
        # 安装全部库 :
        poetry install

        # 添加库 :
        poetry add <module>

        # 退出虚拟环境 :
        deactivate

        # 清理缓存 : ( http / artifacts / store )
        poetry cache clear http --all
        poetry cache clear artifacts --all
        poetry cache clear store --all
"""
import os
from controller import create_app


# @Time    :  2024-10-29 17:11:41
# @Author  :  jiangtong
# @Email   :  gingerqgyy@outlook.com
# @Project :  flask_ocr
# @File    :  run


def run_app(venv='prod'):
    # 从启动命令中获取 'FLASK_ENV' : ( dev / prod ) :
    env = os.getenv('FLASK_ENV', venv)

    # 创建 flask app 对象 :
    app = create_app(env)

    # 启动 flask :
    app.run(host='0.0.0.0', port=app.config['PORT'], debug=app.config['DEBUG'])


if __name__ == '__main__':
    # run_app()
    run_app(venv='dev')
